package com.zheng.study.base.bean;

import org.springframework.http.HttpStatus;

/**
 * Bean类 - 结果集
 * ============================================================================
 * author : fallenpanda
 * createDate:  2018/6/12 。
 * ============================================================================
 */
public class Result {

	/**
	 * 状态 0失败 1成功
	 */
	private int state;
	/**
	 * 返回信息
	 */
	private String message;
	/**
	 * 返回结果
	 */
	private Object data;
	/**
	 * http status
	 */
	private HttpStatus statusCode;

	/**
	 * 成功
	 */
	public boolean isOK() {
		return state == 1;
	}

	/**
	 * 错误
	 */
	public boolean isError() {
		return state == 0;
	}

	public Result(int state, String message, Object data, HttpStatus statusCode) {
		this.state = state;
		this.message = message;
		this.data = data;
		this.statusCode = statusCode;
	}

	public Result() {
		super();
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public HttpStatus getStatusCode() {
		return statusCode;
	}

	public void setStatusCode(HttpStatus statusCode) {
		this.statusCode = statusCode;
	}
}
